package com.aaa.mrcai.service.impl;

import com.aaa.mrcai.mapper.AdminOrderMapper;
import com.aaa.mrcai.pojo.entity.AdminOrder;
import com.aaa.mrcai.query.AdminOrderQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.AdminOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ Author: Lining
 * @ Date: 2021/12/14 15:23
 */
@Service
public class AdminOrderServiceImpl implements AdminOrderService {

    @Autowired
    private AdminOrderMapper adminOrderMapper;

    @Override
    public AjaxResult list(AdminOrderQuery adminOrderQuery) {
        List<AdminOrder> list = adminOrderMapper.list(adminOrderQuery);
        System.out.println("AdminOrderServiceImpladminOrderQuery"+adminOrderQuery);
        System.out.println("AdminOrderService"+list);
        Long aLong = adminOrderMapper.getAdminOrderTotal(adminOrderQuery);
        System.out.println("数量+"+aLong);
        Map<String, Object> map = new HashMap<>();
        map.put("currentPageData",list);
        map.put("currentDataTotal",aLong);
        return AjaxResult.success(map);
    }

    @Override
    public AjaxResult getOneOrder(String soid) {
        List<AdminOrder> list = adminOrderMapper.getOneOrder(soid);
        return AjaxResult.success(list);
    }
}
